// Copyright (C) 2025, ZWSOFT Co., LTD.(Guangzhou)
// Licensed under the MIT License. See LICENSE in the project root for license information.

using MaterialDesignThemes.Wpf;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace TestClient.ViewModel.Util;

public class StatusToPackIconKindConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is TestResult status)
        {
            switch (status)
            {
                case TestResult.Pending:
                    return PackIconKind.PauseCircle;
                case TestResult.Succeeded:
                    return PackIconKind.CheckCircle;
                case TestResult.Failed:
                    return PackIconKind.AlertCircle;
                case TestResult.Unknown:
                    return PackIconKind.HelpCircle;
            }
        }
        return PackIconKind.HelpCircle;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

public class StatusToBrushConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is TestResult status)
        {
            switch (status)
            {
                case TestResult.Unknown:
                    return Brushes.Black;
                case TestResult.Pending:
                    return Brushes.Gray;
                case TestResult.Succeeded:
                    return Brushes.Green;
                case TestResult.Failed:
                    return Brushes.Red;
            }
        }
        return Brushes.Black;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
